<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<html>
  <head>    
    <title>动态设置页面的MIME类型</title>
  </head>
  
  <body>
  	<h2>学生成绩表</h2>
  	<table border="1">
  		<tr>
  			<th>学号
  			<th>姓名
  			<th>成绩
  		</tr>
  		<tr>
  			<td>1
  			<td>小花
  			<td>90
  		</tr>
  		<tr>
  			<td>2
  			<td>小兰
  			<td>99
  		</tr>
  		<tr>
  			<td>3
  			<td>小虎
  			<td>93
  		</tr>
  		<tr>
  			<td>4
  			<td>小怪
  			<td>91
  		</tr>
  	</table>
  	
  	<p>选择以下类型保存或打开页面</p>
  	<form action="" method="post">
  		<input type="radio" name="filetype" value="w">Word
  		<input type="radio" name="filetype" value="e">Excel<br>
  		<input type="submit" name="submit" value="提交">
  	</form>
  	<%
  		String str=request.getParameter("filetype");
  		if(str==null){
  			str="";
  		}else if(str=="w"){
  			response.setContentType("application/msword;charset=utf-8");
  		}else{
  			response.setContentType("application/x-msexcel;charset=utf-8");
  		}
  	 %>
  	
  </body>
</html>
